//
//  SelectInputView.m
//  TeamInformatization
//
//  Created by bigger on 2019/4/7.
//  Copyright © 2019年 SPIC. All rights reserved.
//

#import "SelectInputView.h"

@interface SelectInputView () <UITextFieldDelegate, UIPickerViewDelegate, UIPickerViewDataSource>

@property (nonatomic, strong) SimpleLabel *selectTitle;

@property (nonatomic, strong) UIPickerView *dataPickView;

@property (nonatomic, strong) UITextField *dataTextField;

@end


@implementation SelectInputView

- (instancetype)init
{
    if (self = [super init]) {
        self.backgroundColor = [UIColor whiteColor];
        [self creatViews];
    }
    return self;
}

- (void)creatViews
{
    self.selectTitle = [SimpleLabel initWithText:@"" TextColor:kTitleTextColor TextFont:kFont(PFSCRegular, 15) TextAlignment:NSTextAlignmentLeft];
    [self addSubview:_selectTitle];
    [_selectTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15 * kScaleWidth);
        make.centerY.mas_equalTo(self);
    }];
    
    
    self.dataTextField = [[UITextField alloc] init];
    _dataTextField.textAlignment = NSTextAlignmentCenter;
//    _dataTextField.backgroundColor = [UIColor whiteColor];
    _dataTextField.font = kFont(PFSCRegular, 13);
    _dataTextField.textColor = kTitleTextColor;
    _dataTextField.placeholder = @"请选择";
    _dataTextField.delegate = self;
    [self addSubview:_dataTextField];
    [_dataTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15 * kScaleWidth);
        make.centerY.mas_equalTo(self);
    }];
    
    
    // 分割线
    UILabel *lineLabel = [[UILabel alloc] init];
    lineLabel.backgroundColor = kCommonBGGaryColor;
    [self addSubview:lineLabel];
    [lineLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(0);
        make.left.mas_equalTo(15 * kScaleWidth);
        make.right.mas_equalTo(-15 * kScaleWidth);
        make.height.mas_equalTo(0.5);
        
    }];
    
}

- (void)setDataArray:(NSArray *)dataArray
{
    
    
}


// pickView
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    
    return  1;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    return _dataArray.count;
    
}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    return _dataArray[row];
}

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    
}

- (void)textFieldDidEndEditing:(UITextField *)textField
{
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
